package com.mandao;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * @author snail
 */
@RestController
@SpringBootApplication
@EnableDiscoveryClient
public class ProviderTwoApplication {

	@GetMapping("/greeting")
	public String greet(){
		List<String> greetings = Arrays.asList("hello1","hello2","hello3");
		Random random = new Random();
		System.out.println(greetings.get(random.nextInt(3)));
		return greetings.get(random.nextInt(3));
	}

	@GetMapping("/")
	public String home(){
		return "hi";
	}

	public static void main(String[] args) {
		SpringApplication.run(ProviderTwoApplication.class, args);
	}

}
